package com.soft.order.service;

import com.github.pagehelper.PageInfo;
import com.soft.entity.TOrder;
import com.soft.service.TOrderService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.xml.crypto.Data;
import java.util.Date;

@SpringBootTest
@RunWith(SpringRunner.class)
public class testOrderService {
    @Autowired
    TOrderService tOrderService;
    @Test
    public void testupdate(){
        Date data = new Date(System.currentTimeMillis());
        TOrder tOrder = new TOrder(); //tOrderService.queryById(orderId);
        tOrder.setConfirmTime(data);
        tOrder.setUpdateTime(data);
        tOrder.setId(4);
        tOrder.setStatus(2);
        tOrderService.update(tOrder);
    }

    @Test
    public void testgetUserOrdersAndOrderItems(){
        PageInfo<TOrder> pageInfo = tOrderService.getUserOrdersAndOrderItems(1, 10, 4);
        System.out.println(pageInfo);
    }

    @Test
    public void testVagueFindAllOrders(){
        PageInfo<TOrder> pageInfo = tOrderService.vagueFindAllOrders(1, 10, null);
        System.out.println(pageInfo);
    }
}
